package com.digua.baseiot.api

import com.blankj.utilcode.util.FileUtils
import com.digua.baseiot.config.Config
import com.digua.base.api.ApiBase
import com.digua.base.api.DownloadListener
import java.io.File

class Api {
    companion object {
        /**
         * 下载文件
         */
        fun downloadFile(url: String, saveFileName: String, listener: DownloadListener) {
            val file = File(Config.downloadPath, saveFileName)
            FileUtils.createOrExistsDir(Config.downloadPath)
            FileUtils.delete(file)
            ApiBase.downloadFile(true, url, file.absolutePath, listener)
        }

    }
}